#include "ScopedMutex.h"

WinTools::CScopedMutex::CScopedMutex(CMutex &mutex, bool bTryLock /*= false*/)
: m_Mutex(mutex)
{
	if (bTryLock)
		m_Mutex.TryLock();
	else
		m_Mutex.Lock();
}

WinTools::CScopedMutex::~CScopedMutex()
{
	m_Mutex.Unlock();
}

bool WinTools::CScopedMutex::operator==(bool b)
{
	return m_Mutex.IsLocked();
}
